import java.io.IOException;
import java.net.Socket;
import java.util.HashMap;

public class TcpDictServer extends TcpEchoServer{
    HashMap<String,String> hashMap = new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);
        hashMap.put("word","单词");
        hashMap.put("apple","苹果");
        hashMap.put("banana","香蕉");
    }

    @Override
    public String process(String request) {
        return hashMap.getOrDefault(request,"该单词没有查到");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer tcpDictServer = new TcpDictServer(8090);
        tcpDictServer.start();
    }
}
